To create a minimal master page Monday, Sep 1 2008 

  • Open SharePoint Designer.
  • On the File menu, click New, point to SharePoint Content, and then click the Page tab.
  • Double-click Master Page to create a new master page.
  • Click Design to show the master page in design view. You should see header and left margin areas and several content placeholders in the master page.
  • Click Code to show the master page in code view.
  • Copy the Code into the Master Page.
  • On the File menu, click Save As, provide a unique file name with the .master extension, and then save the file to the master page gallery (/_catalogs/masterpage) in your site collection.

Cheers…

How to: Create a Minimal Master Page Monday, Sep 1 2008 

Introduction
One of the first tasks that you must complete when configuring a Microsoft Office SharePoint Server 2007 Web site is to create one or more master pages. A master page contains references to elements that you can share across multiple pages in an Office SharePoint Server 2007 site, such as navigation, search controls, logon controls, and banner images. A master page can also contain the cascading style sheet (CSS) and ECMAScript (JScript, JavaScript) references that define the overall look and feel of your site. Commonly, every site—and therefore every page—in your site collection uses the same master page to present a consistent user experience across the entire site collection. Depending on your needs, you can use a different master page for one or for all of the sites in your site hierarchy to distinguish the various areas of your portal.
Master Page Galleries
When you provision a site collection in Office SharePoint Server 2007, the system creates a master page gallery that contains all the master pages and page layouts for that site collection. If the site collection uses either the Publishing Portal or Collaboration Portal templates, the master page gallery includes several master pages that are provided with Office SharePoint Server 2007, such as BlueBand.master. These master pages are located in the path C:\Program%20Files\Common%20Files\Microsoft%20Shared\web%20server%20extensions\12\TEMPLATE\FEATURES\PublishingLayouts\MasterPages\, with other example .master pages. You can use any of these master pages as they are, or you can customize them fully to create unique branding for your site.
Why Start with a Minimal Master Page
Creating and completing a master page to begin your SharePoint site customization takes planning and time. If you can, you want to prevent having to rewrite or back out code you don’t need in your master page. This topic shows you how to create a minimal master page that includes only the minimal functionality that Office SharePoint Server 2007 requires so that you have a stable platform upon which to build your own master pages. Creating a minimal master page can help you avoid the time-consuming process of backing code out of a pre-existing .master page such as BlueBand.master, or removing functionality and then building it back in when your customization needs change again.
You can, of course, create a master page from scratch. However, we generally do not recommend this because a truly empty master page does not include all the content placeholders that the Office SharePoint Server 2007 page model needs to work correctly.
The sample code in the following procedure includes only what the Office SharePoint Server 2007 page model requires—necessary content placeholders and controls to work with the page layouts that are included in a default Office SharePoint Server 2007 installation. Office SharePoint Server 2007 requires a master page that includes a title, branding, logon functionality, search functionality, breadcrumb functionality, and basic structural elements such as page areas, separators, borders, consoles, and description placeholders.
The following procedure uses Office SharePoint Designer 2007 as the master page design environment. You can, however, use a text editor, a Web editor such as Microsoft Office SharePoint Designer 2007, or an integrated development environment (IDE) such as Microsoft Visual Studio 2005 to create a master page.The master pages included with Office SharePoint Server 2007 are based on the SPWeb.CustomMasterUrl property of the SPWeb class in Windows SharePoint Services.
Cheers…

How to:Extend the Navigation Provider Saturday, Aug 30 2008 

You can extend the navigation provider in Microsoft Office SharePoint Server 2007 by deriving a custom provider class from any of the default site map providers. Deriving from an Office SharePoint Server 2007 site map provider supplies several benefits such as navigation node caching and security trimming. The following code example derives from the PortalSiteMapProvider class and demonstrates how to add items to the site map provider. Although the site map provider classes have approximately twenty abstract or virtual methods, only a small number must be overridden and implemented in a custom site map provider.
  • Create a Microsoft Visual C# class library project with following code, add the required references, and then build the project.

using System;using System.Collections.Generic;using System.Text;using Microsoft.SharePoint.Publishing;using Microsoft.SharePoint.Publishing.Navigation;using System.Web;using System.Web.UI.WebControls;using System.Configuration;

namespace MyCustomNav

{

public class Navigation: PortalSiteMapProvider

{

public override SiteMapNodeCollection

GetChildNodes(System.Web.SiteMapNode node)

{PortalSiteMapNode pNode = node as PortalSiteMapNode;

if (pNode != null)

{if (pNode.Type == NodeTypes.Area)

{SiteMapNodeCollection nodeColl = base.GetChildNodes(pNode);

SiteMapNode childNode = new

SiteMapNode(this, “”,

“”, “Microsoft”);

SiteMapNode childNode1 = new

SiteMapNode(this, “”,

“”,

“Support”);nodeColl.Add(childNode);

SiteMapNodeCollection test = new

SiteMapNodeCollection();test.Add(childNode1);

childNode.ChildNodes = test;return nodeColl;

}elsereturn base.GetChildNodes(pNode);

}elsereturn new SiteMapNodeCollection();

}}}

  • Copy the .dll file you created in step 1, and then paste it into the Office SharePoint Server 2007 virtual directory’s bin folder.
  • Create the following entry in the web.config file for the Web application, and then set the trust level to Full.

<add name=”MyCustomNavigationProvider” type=”MyCustomNav.Navigation, MyCustomNav”
NavigationType=”Current”/>

  • Create a custom master page and add the following code under the top navigation’s ContentPlaceHolder element.

<sharepoint:aspmenuid=”topnavigationmenu” runat=”server” datasourceid=”topSiteMap1″ enableviewstate=”false” accesskey=””>” Orientation=”Horizontal” StaticDisplayLevels=”1″ MaximumDynamicDisplayLevels=”3″ DynamicHorizontalOffset=”0″ StaticPopoutImageUrl=”/_layouts/images/menudark.gif” StaticPopoutImageTextFormatString=”” DynamicHoverStyle-BackColor=”#CBE3F0″ SkipLinkText=”” StaticSubMenuIndent=”0″ CssClass=”ms-topNavContainer”>

<staticmenustyle/><staticmenuitemstyle cssclass=”ms-topnav” itemspacing=”0px”/><staticselectedstyle cssclass=”ms-topnavselected”/><statichoverstyle cssclass=”ms-topNavHover”/><dynamicmenustyle backcolor=”#F2F3F4″ bordercolor=”#A7B4CE” borderwidth=”1px”/><dynamicmenuitemstyle cssclass=”ms-topNavFlyOuts”>/><dynamicselectedstyle cssclass=”ms-topNavFlyOutsSelected”/></SharePoint:AspMenu>

<asp:sitemapdatasource showstartingnode=”False” sitemapprovider=”MyCustomNavigationProvider” id=”topSiteMap1″ runat=”server” startfromcurrentnode=”true”>

  • Reset Microsoft Internet Information Server (IIS). Your SharePoint site should now show the updated navigation from the extended navigation provider.

Still more to come…

Cheers…


Customizing Navigation Controls and Providers Sunday, Aug 17 2008 

To customize navigation, you should rely on the ASP.NET Site Navigation mechanism, because it provides a standard, consistent, and easily managed solution.
Customizing Web Display Controls (Menu, TreeView, and SiteMapPath) :
You can customize the look and feel of standard display controls by using cascading style sheets (CSSs). You can also write your own ASP.NET 2.0 controls and use them in Office SharePoint Server 2007 navigation. To learn more, see the Menu class documentation.

Note: Office SharePoint Server 2007 also provides default navigation components that you can customize, such as the Content By Query Web Part and the Table of Contents Web Part. You can configure these two controls to present a custom selection of links.

To implement your own site map provider, you can derive a custom provider class from any of the default site map providers. Office SharePoint Server 2007 includes several default providers. You can also derive a custom provider class from the SiteMapProvider class in the System.Web namespace. However, deriving the Office SharePoint Server 2007 site map providers supplies several additional benefits such as navigation node caching and security trimming. Therefore, you should use the Office SharePoint Server 2007 caching and security trimming infrastructure instead of writing your own caching and security trimming in a custom provider by deriving from the default providers. Although the site map provider classes have approximately twenty abstract or virtual methods, only a small number must be overridden and implemented in a custom site map provider. The following code example derives from the PortalSiteMapProvider class and demonstrates how to add items to the site map provider.

public class CustomNavProviderWithList : PortalSiteMapProvider {
public override SiteMapNodeCollection

GetChildNodes(System.Web.SiteMapNode node) {
PortalSiteMapNode portalNode = node as PortalSiteMapNode;
if (portalNode != null)
{
if (portalNode.Type == NodeTypes.Area)
{ SiteMapNodeCollection nodeColl = base.GetChildNodes(portalNode);
using (SPSite currentSite = new SPSite(portalNode.Url))
{ SPWeb currentWeb = currentSite.OpenWeb();
SPListCollection lists = currentWeb.Lists;
foreach (SPList list in lists)
{ string listUrl = list.DefaultViewUrl;
PortalSiteMapNode childNode =
new PortalSiteMapNode(webNode,
listUrl, NodeTypes.custom, list.Title, listUrl, null);
nodeColl.Add(childNode);
} }
return nodeColl;
} else { return base.GetChildNodes(portalNode);
} }
else { return new SiteMapNodeCollection(); } } }

Cheers…

PortalSiteMapProvider Saturday, Aug 16 2008 

The PortalSiteMapProvider object is the true source of hierarchical navigation data and it provides the data to the PortalSiteMapDataSource object. The PortalSiteMapProvider retrieves nodes from the Windows SharePoint Services 3.0 SPNavigation store. You use the SPNavigation object to create static links and groupings. After you provide static links and groupings, the application merges in dynamic items that represent Web sites and pages with the static links and groupings. Office SharePoint Server 2007 also applies security trimming so that users see only the navigation items to which they have permission to navigate.
Declare named providers in the application’s web.config file to make them widely accessible. Declarations of the two most important PortalSiteMapProvider objects—
CombinedNavSiteMapProvider and CurrentSiteNavSiteMapProvider—are shown in the following code.

<add name=”CombinedNavSiteMapProvider” description=

“MOSS 2007 provider for Combined navigation” Type=”Microsoft.SharePoint.Publishing.
Navigation.PortalSiteMapProvider”
NavigationType=”Combined” EncodeOutput=”true”>
<add name=”CurrentNavSiteMapProvider” description=
“MOSS 2007 provider for Current navigation” Type=
“Microsoft.SharePoint.Publishing.
Navigation.PortalSiteMapProvider”
NavigationType=”Current” EncodeOutput=”true”/>
Note : The name of the first provider, CombinedNavSiteMapProvider, matches the value specified for the SiteMapProvider property. This indicates that a Horizontal menu will be created.
The following are the properties,
  1. NavigationType – Gets or sets the type of navigation for this navigation provider. Available options include “Combined”, “Current”, and “Global” and behave as specified by the next three properties: CombinedNavSiteMapProvider, CurrentSiteMapProvider, and CurrentSiteNavSiteMapProviderNoEncode.
  2. CombinedNavSiteMapProvider – Gets the PortalSiteMapProvider object that is attached by default to the global navigation menu.
  3. CurrentSiteNavSiteMapProvider – Gets the PortalSiteMapProvider object that is attached by default to the current navigation menu or the QuickLaunch toolbar.
  4. CurrentSiteNavSiteMapProviderNoEncode – Gets the PortalSiteMapProvider object that is attached by default to the breadcrumb navigation.
    Declare this property almost identically to CurrentSiteNavSiteMapProvider, but exclude the EncodeOutput=”true” attribute.
  5. GlobalNavSiteMapProvider – Gets a PortalSiteMapProvider object with the NavigationType property set to Global.
  6. EncodeOutput – Gets or sets whether to HTML-encode the Title property of any PortalSiteMapNode object returned by the provider.The ASP.NET 2.0 menu control does not automatically HTML-encode the Title property when rendering. However, the ASP.NET 2.0 SiteMapPath control does HTML-encode the Title property.
  7. DynamicChildLimit – Gets or sets the number of dynamic child items to show at each level. Dynamic child items can be subsites (any SPWeb objects) and pages.
  8. RequireUniqueKeysForNodes – Gets or sets whether nodes returned from the provider should each have unique values for their Key properties.
    To enable menu highlighting to work correctly on authored links and headings, set RequireUniqueKeysForNodes=”false”. This does not cause problems when attaching to an ASP.NET 2.0 menu control through a data source, but for most other display controls, declare RequireUniqueKeysForNodes=”true”.
  9. IncludeSubSites – Gets or sets whether this provider returns subsites.

Cheers…

PortalSiteMapDataSource Saturday, Aug 16 2008 

The PortalSiteMapDataSource is a data source specific to Office SharePoint Server 2007 that retrieves data from the PortalSiteMapProvider object and exposes data according to the ASP.NET 2.0 hierarchical data source interface. The PortalSiteMapDataSource object specifies the name of the PortalSiteMapProvider object it uses to retrieve data through the ASP.NET 2.0 SiteMapProvider property.
When the master page markup includes the DataSourceID=”GlobalNavDataSource” attribute, the application returns a PortalSiteMapDataSource object.

<PublishingNavigation:PortalSiteMapDataSource ID=”GlobalNavDataSource” Runat=”server” SiteMapProvider=”CombinedNavSiteMapProvider” ShowStartingNode=”false” StartFromCurrentNode=”true” StartingNodeOffset=”0″ TrimNonCurrentTypes=”Heading” TreatStartingNodeAsCurrent=”true”/>

The properties are,

  1. ShowStartingNode – Affects whether the starting node is returned by the data source.When this property is set to true, the data source returns the starting node. The menu receives the starting node, which can be the root node, and items below the starting node.When this property is set to false, the data source does not return the starting node. The menu receives only the items below the starting node.
  2. StartFromCurrentNode – Affects where the data source starts. That is, this property sets which section of the overall site hierarchy the data source control returns to the menu.When this property is set to true, Office SharePoint Server 2007 instructs the PortalSiteMapDataSource object to apply its rules for determining where it should be starting.
  3. StartingNodeOffset – Gets or sets a positive or negative integer offset from the starting node that determines the top-level site hierarchy that is exposed by the DataSourceControl object.The default is 0, which indicates that the top-level site hierarchy exposed by the SiteMapDataSource object is the same as the starting node.The effect of this property is variable, undefined, and depends on site hierarchy details that are out of scope for this topic.
  4. TrimNonCurrentTypes – Allows context-based and type-based node trimming.
    In this example, TrimNonCurrentTypes=”Heading”, which instructs the data source to remove any nodes of type Heading that are not directly below the current node.
    You can specify multiple values for this property in a comma-delimited list. Available values are defined in the
    NodeTypes enumeration.
  5. TrimNonAncestorTypes – Trims any specified types that are not directly below the current site or one of its ancestors.
  6. TrimNonAncestorDescendantTypes – Trims any nodes of specified types that are not below the current site or one of its ancestor or descendant sites.
  7. TreatStartingNodeAsCurrent – Affects which node is treated as the current node for trimming purposes. By default, current node refers to the node representing the item that is currently being visited.When TreatStartingNodeAsCurrent is set to true, the starting node of the data source is treated as the context or trimming node.

Cheers…

Horizontal and Vertical Menus Saturday, Aug 16 2008 

When you first create a site structure that includes a root or top-level site, more than one Web site, and pages and additional sites that are children of the top-level site, Office SharePoint Server 2007 creates two menus: a horizontal (top) menu, and a vertical (left) menu.
Horizontal and vertical menus are declared in master page markup. The following example declares a horizontal menu.

<SharePoint:AspMenu ID=”GlobalNav” Runat=”server” DataSourceID=”GlobalNavDataSource” Orientation=”Horizontal” StaticDisplayLevels=”1″ MaximumDynamicDisplayLevels=”1″/>

The vertical menu is declared similarly, but uses different properties from the horizontal menu. These properties are identical to those available on the ASP.NET 2.0 Menu control.

The following are the properties included by default in master page markup for both horizontal and vertical menus:

  1. DataSourceID – Specifies the data source control that provides the hierarchical data for this menu. In the previous example code, the DataSourceID points to a control with the ID “GlobalNavDataSource”.
  2. Orientation – Specifies whether the menu is horizontal or vertical.
  3. StaticDisplayLevels – Specifies the number of hierarchy levels to show in the menu at the same time.
  4. MaximumDynamicDisplayLevels – Specifies the number of levels to show in dynamic fly-out menus.

Cheers…

Working with Menus and Navigation Objects Saturday, Aug 16 2008 

Any declaration of Horizontal or Vertical menu instructions for navigation in XML for the master page, two classes are used to make the navigation work:
  1. PortalSiteMapDataSource
  2. PortalSiteMapProvider

The PortalSiteMapProvider object provides the site hierarchy (navigation structure) and monitors the relationship between nodes.Many named instances of this site map provider are listed in the web.config file, and are also available through static properties on this class that the master pages in Office SharePoint Server 2007 deliver. Office SharePoint Server 2007 uses these named instances to provide data to the horizontal and vertical navigation menus. The application shares named instances across all Web requests on the current application domain. The class stores no session information. If necessary, session information is stored on the HttpContext class.

The PortalSiteMapDataSource object maps navigation features from the PortalSiteMapProvider and filters navigation elements to determine which are viewable to the user in the horizontal or vertical menus or in breadcrumbs.It also provides type-based trimming of navigation nodes and an extensible trimming mechanism.

Let us see the Horizontal and Vertical menus in detail in next posts…

Cheers…


Customize Navigation, How? Saturday, Aug 16 2008 

Most Web sites employ some form of customized user interface (UI) that provides users with visual clues on how to navigate in the site more easily, and find the information they need. Although the look and feel (or branding) can vary from site to site, the same basic navigation elements are usually present, such as navigation bars and menus that expose options a user can choose to navigate to a subsite or page.
you can customize it through programmatically and also through the UI, including:

  • Using the provider and data source APIs to customize the structure and behavior of vertical and horizontal menus.
  • Understanding Navigation Settings UI options and using them to set up a site navigation hierarchy.
  • Replacing the default navigation provider included in Office SharePoint Server 2007 with your own custom provider.
  • Configuring multiple navigation providers for a site.

Navigation Fundamentals

To make it easy to build effective navigation elements such as horizontal and vertical menus and breadcrumb navigation, Office SharePoint Server 2007 takes advantage of Microsoft ASP.NET 2.0 pluggable navigation—the Provider model. The Provider model defines a provider as a software module that provides a uniform interface between a service and a database.For example, by developing custom providers, you can store state data in a variety of external data providers, such as front-end Web services, XML files, and databases.

Office SharePoint Server 2007 navigation is site-centric, meaning that each Web site in a site collection can determine the way the application displays each navigation item beneath it in the site hierarchy: all the way down to the next site. As a result, each site has several navigation options that you can set through the UI or programmatically.

The default navigation system is based on the hierarchy for the site, and the navigation through the site occurs based on choices made through the UI or programmatically. Options you can set include whether to show subsites and pages in navigation, whether to sort navigation items manually or automatically, and how to handle individual sorting and display attributes and behavior of individual navigation items.
When you define vertical and horizontal menus, you can deploy a section of the navigation with one or more static or dynamic menu levels:

  • Static menu items represent levels of hierarchy and are usually hyperlinked. You can create additional levels of static and dynamic menu items under the top-level navigation item (the root).
  • Office SharePoint Server 2007 creates dynamic—fly-out—menu options based on site structure. The site hierarchy defines the levels in the navigation menu.

Your site can have any number of static and dynamic levels.

References : Sharepoint Customisation

Cheers…